Hi Eric,
When the MCode or SCode is configured in KMotionCNC | Tool Setup there is a "Var" setting which determines which persist.UserData[] variable receives any related data.
HTH Regards TK
| Group: DynoMotion |
Message: 8407 |
From: eric_kato_sanders |
Date: 9/27/2013 |
| Subject: Re: Another basic question about persist.UserData |
Hi Tom, In the case of the spindle RPM however, I will have the code to set the duty cycle based upon the requested RPM and the max rpm. This code will be in a while(1) loop, so that it is continuously evaluated and the pwm signal set. Do I need to send a message back to KMotionCNC to direct it to stuff the requested rpm into the userdata buffer to deal with it? I know that would be one method, but I don't know if that is totally convoluted or not.
Eric
---In DynoMotion@yahoogroups.com, <dynomotion@yahoogroups.com> wrote:
Hi Eric,
When the MCode or SCode is configured in KMotionCNC | Tool Setup there is a "Var" setting which determines which persist.UserData[] variable receives any related data.
HTH Regards TK
| Group: DynoMotion |
Message: 8408 |
From: eric_kato_sanders |
Date: 9/28/2013 |
| Subject: Re: Another basic question about persist.UserData |
I forgot to add that the pwm code will be in my init.c file.
---In dynomotion@yahoogroups.com, <eric@...> wrote:
Hi Tom, In the case of the spindle RPM however, I will have the code to set the duty cycle based upon the requested RPM and the max rpm. This code will be in a while(1) loop, so that it is continuously evaluated and the pwm signal set. Do I need to send a message back to KMotionCNC to direct it to stuff the requested rpm into the userdata buffer to deal with it? I know that would be one method, but I don't know if that is totally convoluted or not.
Eric
---In DynoMotion@yahoogroups.com, <dynomotion@yahoogroups.com> wrote: Hi Eric,
When the MCode or SCode is configured in KMotionCNC | Tool Setup there is a "Var" setting which determines which persist.UserData[] variable receives any related data.
HTH Regards TK
| Group: DynoMotion |
Message: 8409 |
From: Tom Kerekes |
Date: 9/28/2013 |
| Subject: Re: Another basic question about persist.UserData |
Hi Eric, You didn't explain how your hardware works, but you shouldn't require a loop in your Init.c file to continuously do anything. The way the PWMs work is that you only need to write to them once to change the duty cycle and the PWM will maintain that duty cycle. KMotionCNC will invoke your Spindle program whenever the User changes the Speed so all your program needs to do is set the new speed and terminate. You will need to create 4 programs for M3,M4,M5, and S to turn your spindle on CW, or CCW, or off, or to change the speed. This works out pretty simple if the on/off/direction control of your Spindle is separate from the speed setting. But if the only way to turn off your spindle is to set the speed setting (PWM) to zero then there is an additional complication. The complication is
added because if the program simply sets the new speed whenever the speed is changed, then if the Operator changes the speed when the spindle is turned off it can cause the spindle to come on. So to solve this issue the programs need to be a bit smarter and detect if the speed is changed when the spindle is off, to just save the new speed setting someplace (in persist.UserData variables) so that it can be set the next time the spindle is turned on. There is an example of how to handle this in the 4 V2 (version 2) programs in the \C Programs\SpindelUsingJogs directory. Although you will need to change these programs to command a PWM instead of commanding Jogs. Your first step should be to test and understand how to control your spindle speed using something like the PWM1KHz.c example. HTH Regards TK
| Group: DynoMotion |
Message: 8410 |
From: eric_kato_sanders |
Date: 9/28/2013 |
| Subject: Re: Another basic question about persist.UserData |
Thanks Tom, Thinks finally clicked.
The Novakon NM-145 mill uses a brushless mother. As far as I can tell, it doesn't use a direction signal, (my mach setup screen show it being used, and the mill isn't advertised as being reversible).
I was able to turn on the spindle. I checked the signal coming out of the SmoothStepper and it is a 0-5 volt, 2khz signal. I was able to get pretty close to that and the spindle ran, although backwards. With basically the same pulse coming in, any idea why would it run backwards?
The biggest problem is that after about a minute of running, the breakout board on the mill faults out and I need to reset it. I'm going to try and hook the smooth stepper up, but disconnect the SS PWM signal and supply with the PWM with the KFlop.
---In DynoMotion@yahoogroups.com, <dynomotion@yahoogroups.com> wrote:
Hi Eric, You didn't explain how your hardware works, but you shouldn't require a loop in your Init.c file to continuously do anything. The way the PWMs work is that you only need to write to them once to change the duty cycle and the PWM will maintain that duty cycle. KMotionCNC will invoke your Spindle program whenever the User changes the Speed so all your program needs to do is set the new speed and terminate. You will need to create 4 programs for M3,M4,M5, and S to turn your spindle on CW, or CCW, or off, or to change the speed. This works out pretty simple if the on/off/direction control of your Spindle is separate from the speed setting. But if the only way to turn off your spindle is to set the speed setting (PWM) to zero then there is an additional complication. The complication is
added because if the program simply sets the new speed whenever the speed is changed, then if the Operator changes the speed when the spindle is turned off it can cause the spindle to come on. So to solve this issue the programs need to be a bit smarter and detect if the speed is changed when the spindle is off, to just save the new speed setting someplace (in persist.UserData variables) so that it can be set the next time the spindle is turned on. There is an example of how to handle this in the 4 V2 (version 2) programs in the \C Programs\SpindelUsingJogs directory. Although you will need to change these programs to command a PWM instead of commanding Jogs. Your first step should be to test and understand how to control your spindle speed using something like the PWM1KHz.c example. HTH Regards TK
| Group: DynoMotion |
Message: 8411 |
From: TK |
Date: 9/28/2013 |
| Subject: Re: Another basic question about persist.UserData |
Hi Eric,
It appears there must be a direction signal somewhere.
Regards TK On Sep 28, 2013, at 2:58 PM, <eric@...> wrote:
Thanks Tom, Thinks finally clicked.
The Novakon NM-145 mill uses a brushless mother. As far as I can tell, it doesn't use a direction signal, (my mach setup screen show it being used, and the mill isn't advertised as being reversible).
I was able to turn on the spindle. I checked the signal coming out of the SmoothStepper and it is a 0-5 volt, 2khz signal. I was able to get pretty close to that and the spindle ran, although backwards. With basically the same pulse coming in, any idea why would it run backwards?
The biggest problem is that after about a minute of running, the breakout board on the mill faults out and I need to reset it. I'm going to try and hook the smooth stepper up, but disconnect the SS PWM signal and supply with the PWM with the KFlop.
---In DynoMotion@yahoogroups.com, < dynomotion@yahoogroups.com> wrote: Hi Eric, You didn't explain how your hardware works, but you shouldn't require a loop in your Init.c file to continuously do anything. The way the PWMs work is that you only need to write to them once to change the duty cycle and the PWM will maintain that duty cycle. KMotionCNC will invoke your Spindle program whenever the User changes the Speed so all your program needs to do is set the new speed and terminate. You will need to create 4 programs for M3,M4,M5, and S to turn your spindle on CW, or CCW, or off, or to change the speed. This works out pretty simple if the on/off/direction control of your Spindle is separate from the speed setting. But if the only way to turn off your spindle is to set the speed setting (PWM) to zero then there is an additional complication. The complication is
added because if the program simply sets the new speed whenever the speed is changed, then if the Operator changes the speed when the spindle is turned off it can cause the spindle to come on. So to solve this issue the programs need to be a bit smarter and detect if the speed is changed when the spindle is off, to just save the new speed setting someplace (in persist.UserData variables) so that it can be set the next time the spindle is turned on. There is an example of how to handle this in the 4 V2 (version 2) programs in the \C Programs\SpindelUsingJogs directory. Although you will need to change these programs to command a PWM instead of commanding Jogs. Your first step should be to test and understand how to control your spindle speed using something like the PWM1KHz.c example. HTH Regards TK
| | | | | | | | | | | |